using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace RestNews.Data.Models.Mapping
{
    public class NonceStorageMap : EntityTypeConfiguration<NonceStorage>
    {
        public NonceStorageMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Nonce)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(32);

            // Table & Column Mappings
            this.ToTable("NonceStorage");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Nonce).HasColumnName("Nonce");
            this.Property(t => t.NonceCount).HasColumnName("NonceCount");
            this.Property(t => t.ExpirationDate).HasColumnName("ExpirationDate");
        }
    }
}
